import statusCode from "./status_code"

// 请求状态处理
export async function statusCodeHandle(code) {
	uni.showToast({
		title: statusCode.filter(v => code === v.code)[0]['msg'],
		icon: 'none'
	})
}

export async function request(options) {
	const [err, res] = await uni.request(options)
	if (res.statusCode !== 200) statusCodeHandle(res.statusCode)
	return res.data
}
